<?php
$file = "pwd.txt";
$uid = posix_getuid();
$euid = posix_geteuid();

fprintf(STDOUT,"uid=%d,euid=%d\n",$uid,$euid);

//posix_setuid($euid);
//posix_seteuid($euid);

$uid = posix_getuid();
$euid = posix_geteuid();

fprintf(STDOUT,"uid=%d,euid=%d\n",$uid,$euid);
fprintf(STDOUT,"uid=%d,euid=%d\n",$uid,$euid);

if (posix_access($file,POSIX_W_OK)){
    fprintf(STDOUT,"我能修改...\n");
    $fd = fopen($file,"a+");
    fwrite($fd,"php is the best");
    fclose($fd);
}else{
    fprintf(STDOUT,"我不能修改次文件...\n");
}
